package role_api

import (
	"context"

	v1 "gf-xb-api/api/role_api/v1"
	"gf-xb-api/internal/service"
	"gf-xb-api/utility/xpointer"
)

func (c *ControllerV1) Disable(ctx context.Context, req *v1.DisableReq) (res *v1.DisableRes, err error) {

	var bTrue = xpointer.GetPointer(true)
	var bFalse = xpointer.GetPointer(false)

	err = service.RoleApi().Disable(ctx, req.Ids)
	if err != nil {
		return (*v1.DisableRes)(bFalse), err
	}

	return (*v1.DisableRes)(bTrue), nil

}
